import java.util.*;

public class Main {
    public static void main(String[] args) {
//        普通队列
        Queue<Integer> queue = new LinkedList<>();
//        双端队列的线性实现
        Deque<Integer> stack = new ArrayDeque<>();
//        双端队列的链式实现
        Deque<Integer> deque = new LinkedList<>();
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        System.out.println(queue.size());
        System.out.println(queue.peek());
    }
    public static void main3(String[] args) {
        int j = 1;
            for (int i = 1; i >= j; i++) {
                if (i == 10){
                    return;
                }
                for (j = 1; j <= i; j++) {
                    System.out.print(i + " * "+ j + " = " +(i*j) + " ");
                }
                System.out.println();
            }


    }
    public static void main2(String[] args) {
        LinkedList<Integer> stack = new LinkedList<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        System.out.println( stack.pop());
        System.out.println(stack.peek());

    }
    public static void main1(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
//      一定要保证时间复杂度为（O1）
//        单项链表：头插法（只能）
//        双向链表，头插法和尾插法都可以
//        获取栈顶元素的方法
//        pop:删除元素
        int ret = stack.pop();
        System.out.println(ret);
//        peek:获取元素，不删除
        int ret2 = stack.peek();
        System.out.println(ret2);

        System.out.println(stack.empty());
    }
}